/* Agent Manager Styles */

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--sidebar-width: 250px;
	--header-height: 35px;
}

.agent-manager-container {
	display: flex;
	height: 100vh;
	font-family: var(--vscode-font-family);
	background: var(--vscode-editor-background);
	color: var(--vscode-editor-foreground);
	font-size: var(--vscode-font-size);
}

/* Sidebar */
.sidebar {
	width: var(--sidebar-width);
	min-width: 200px;
	border-right: 1px solid var(--vscode-sideBar-border);
	display: flex;
	flex-direction: column;
	background: var(--vscode-sideBar-background);
	color: var(--vscode-sideBar-foreground);
}

.sidebar-header {
	height: var(--header-height);
	padding: 0 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--vscode-sideBarSectionHeader-background);
	color: var(--vscode-sideBarSectionHeader-foreground);
	border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border, transparent);
	font-size: calc(var(--vscode-font-size) * 0.85);
	font-weight: bold;
	text-transform: uppercase;
}

/* New Agent Item - Primary action at top of sidebar */
.new-agent-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	margin: 8px;
	cursor: pointer;
	border-radius: 4px;
	background: var(--vscode-button-secondaryBackground);
	color: var(--vscode-button-secondaryForeground);
	font-size: var(--vscode-font-size);
	font-weight: 500;
	border: 1px solid var(--vscode-button-border, transparent);
	transition: background-color 0.1s;
}

.new-agent-item:hover {
	background: var(--vscode-button-secondaryHoverBackground);
}

.new-agent-item.selected {
	background: var(--vscode-button-background);
	color: var(--vscode-button-foreground);
}

.new-agent-item:focus {
	outline: 1px solid var(--vscode-focusBorder);
	outline-offset: 1px;
}

/* Section header for Sessions list */
.sidebar-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px 4px;
	font-size: calc(var(--vscode-font-size) * 0.85);
	font-weight: 600;
	text-transform: uppercase;
	color: var(--vscode-sideBarSectionHeader-foreground);
	opacity: 0.8;
}

.sidebar-section-header .icon-btn {
	opacity: 0.6;
}

.sidebar-section-header .icon-btn:hover:not(:disabled) {
	opacity: 1;
}

.sidebar-section-header .icon-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.session-list {
	flex: 1;
	overflow-y: auto;
}

.session-item {
	padding: 4px 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	border: 1px solid transparent; /* Placeholder for focus border */
}

.session-item:hover {
	background: var(--vscode-list-hoverBackground);
	color: var(--vscode-list-hoverForeground);
}

.session-item.selected {
	background: var(--vscode-list-activeSelectionBackground);
	color: var(--vscode-list-activeSelectionForeground);
}

.session-item:focus {
	outline: 1px solid var(--vscode-list-focusOutline);
}

.status-icon {
	font-size: 12px;
	width: 14px;
	text-align: center;
}

.status-icon.done {
	color: var(--vscode-charts-green);
}

.status-icon.error {
	color: var(--vscode-charts-red);
}

.status-icon.stopped {
	color: var(--vscode-charts-orange);
}

@keyframes spin {
	100% {
		transform: rotate(360deg);
	}
}

.session-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.session-label {
	font-size: var(--vscode-font-size);
	font-weight: 300;
	color: var(--vscode-foreground);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.4;
}

.session-meta {
	font-size: calc(var(--vscode-font-size) * 0.85);
	color: var(--vscode-descriptionForeground);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.icon-btn {
	width: 20px;
	height: 20px;
	border: none;
	background: transparent;
	color: inherit;
	border-radius: 3px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0; /* Hidden by default, show on hover */
}

.session-item:hover .icon-btn,
.session-item.selected .icon-btn {
	opacity: 0.7;
}

.icon-btn:hover {
	background: var(--vscode-toolbar-hoverBackground);
	opacity: 1;
}

.no-sessions {
	padding: 20px;
	text-align: center;
	color: var(--vscode-descriptionForeground);
	font-size: var(--vscode-font-size);
}

/* Main Content */
.session-detail {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--vscode-editor-background);
}

.detail-header {
	padding: 10px 20px;
	border-bottom: 1px solid var(--vscode-editorGroup-border);
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	background: var(--vscode-editor-background);
}

.header-info {
	flex: 1;
	min-width: 0;
	margin-right: 16px;
}

.header-title {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.header-meta {
	font-size: 12px;
	color: var(--vscode-descriptionForeground);
	display: flex;
	gap: 12px;
}

.header-actions {
	display: flex;
	gap: 8px;
}

/* Full Auto Banner */
.full-auto-banner {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 20px;
	background: var(--vscode-inputValidation-warningBackground, rgba(255, 204, 0, 0.1));
	border-bottom: 1px solid var(--vscode-inputValidation-warningBorder, var(--vscode-charts-yellow));
	color: var(--vscode-inputValidation-warningForeground, var(--vscode-editor-foreground));
	font-size: 12px;
}

.full-auto-banner svg {
	color: var(--vscode-charts-yellow);
	flex-shrink: 0;
}

.btn {
	padding: 4px 12px;
	border-radius: 2px;
	font-size: 12px;
	cursor: pointer;
	border: 1px solid transparent;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.btn-primary {
	background: var(--vscode-button-background);
	color: var(--vscode-button-foreground);
}

.btn-primary:hover {
	background: var(--vscode-button-hoverBackground);
}

.btn-secondary {
	background: var(--vscode-button-secondaryBackground);
	color: var(--vscode-button-secondaryForeground);
}

.btn-secondary:hover {
	background: var(--vscode-button-secondaryHoverBackground);
}

.btn-danger {
	background: var(--vscode-errorForeground);
	color: var(--vscode-button-foreground);
}

/* Messages Area */
.messages-container {
	flex: 1;
	overflow-y: auto;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.messages-list {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.message-item {
	padding: 10px 20px;
	/* border-bottom: 1px solid var(--vscode-editorGroup-border); -- Removed for cleaner look */
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.message-item:hover {
	background-color: var(--vscode-list-hoverBackground);
}

/* Compact API Request Style */
.message-item.api-req {
	padding: 4px 20px;
	opacity: 0.7;
}

.message-item.api-req:hover {
	opacity: 1;
}

.message-icon {
	margin-top: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.message-content-wrapper {
	flex: 1;
	min-width: 0;
}

.message-header {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 4px;
}

.message-author {
	font-weight: 600;
	font-size: var(--vscode-font-size);
}

.message-ts {
	font-size: calc(var(--vscode-font-size) * 0.85);
	color: var(--vscode-descriptionForeground);
}

.message-cost {
	font-size: calc(var(--vscode-font-size) * 0.85);
	color: var(--vscode-descriptionForeground);
	margin-left: auto;
	border: 1px solid var(--vscode-input-border);
	padding: 0 4px;
	border-radius: 3px;
}

.message-body {
	font-size: var(--vscode-font-size);
	line-height: 1.5;
	overflow-wrap: break-word;
}

/* Markdown Styles (Simplified) */
.markdown-content p {
	margin-bottom: 0.5em;
}

.markdown-content pre {
	background: var(--vscode-textCodeBlock-background);
	padding: 8px;
	border-radius: 4px;
	overflow-x: auto;
	margin: 8px 0;
	border: 1px solid var(--vscode-widget-border);
}

.markdown-content code {
	font-family: var(--vscode-editor-font-family);
	font-size: 90%;
}

.markdown-content :not(pre) > code {
	background: var(--vscode-textCodeBlock-background);
	padding: 2px 4px;
	border-radius: 3px;
}

/* Forms */
.center-form {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	max-width: 600px;
	margin: 0 auto;
	text-align: center;
}

.center-form h2 {
	margin-bottom: 8px;
	font-weight: 500;
}

.center-form p {
	color: var(--vscode-descriptionForeground);
	margin-bottom: 24px;
}

.prompt-input {
	width: 100%;
	padding: 8px;
	background: var(--vscode-input-background);
	color: var(--vscode-input-foreground);
	border: 1px solid var(--vscode-input-border);
	border-radius: 2px;
	font-family: inherit;
	font-size: var(--vscode-font-size);
	resize: vertical;
	min-height: 80px;
}

.prompt-input:focus {
	outline: 1px solid var(--vscode-focusBorder);
	border-color: var(--vscode-focusBorder);
}

/* Chat Input Styles */
.chat-input-container {
	padding: 12px 20px 20px 20px;
	background: var(--vscode-editor-background);
}

.chat-input-wrapper {
	background: var(--vscode-input-background);
	border: 1px solid var(--vscode-input-border);
	border-radius: 6px;
	padding: 8px 12px;
	display: flex;
	flex-direction: column;
	position: relative;
}

.chat-input-wrapper:focus-within {
	border-color: var(--vscode-focusBorder);
	outline: 1px solid var(--vscode-focusBorder);
}

.chat-textarea {
	background: transparent;
	border: none;
	color: var(--vscode-input-foreground);
	font-family: inherit;
	font-size: var(--vscode-font-size);
	resize: none;
	outline: none;
	width: 100%;
	min-height: 24px;
	line-height: 1.4;
	padding-right: 24px; /* Space for sparkles */
}

.input-decoration-icon {
	position: absolute;
	top: 10px;
	right: 10px;
	opacity: 0.5;
	pointer-events: none;
}

.chat-input-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 8px;
}

.left-actions {
	display: flex;
	gap: 8px;
}

.right-actions {
	display: flex;
	gap: 8px;
}

.action-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--vscode-input-background);
	border: 1px solid var(--vscode-input-border);
	color: var(--vscode-foreground);
	border-radius: 4px;
	padding: 2px 8px;
	font-size: calc(var(--vscode-font-size) * 0.85);
	cursor: pointer;
	opacity: 0.8;
}

.action-btn:hover:not(:disabled) {
	background: var(--vscode-list-hoverBackground);
	opacity: 1;
}

.action-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.icon-action-btn {
	background: transparent;
	border: none;
	color: var(--vscode-foreground);
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.7;
}

.icon-action-btn:hover:not(:disabled) {
	background: var(--vscode-toolbar-hoverBackground);
	opacity: 1;
}

.icon-action-btn.send-btn {
	color: var(--vscode-button-foreground);
}

.icon-action-btn.send-btn.active {
	color: var(--vscode-charts-blue);
}

.icon-action-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* Session Error States */
.status-error {
	color: var(--vscode-errorForeground);
}

.session-error-banner {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 10px 20px;
	background: var(--vscode-inputValidation-errorBackground, rgba(255, 0, 0, 0.1));
	border-bottom: 1px solid var(--vscode-inputValidation-errorBorder, var(--vscode-errorForeground));
	color: var(--vscode-errorForeground);
	font-size: var(--vscode-font-size);
}

.session-error-banner svg {
	flex-shrink: 0;
	margin-top: 2px;
}

/* Form Validation */
.prompt-input-error {
	border-color: var(--vscode-inputValidation-errorBorder, var(--vscode-errorForeground)) !important;
}

.prompt-input-error:focus {
	outline-color: var(--vscode-inputValidation-errorBorder, var(--vscode-errorForeground));
}

.validation-error {
	color: var(--vscode-errorForeground);
	font-size: 12px;
	margin-top: 4px;
	text-align: left;
}

/* Loading Spinner */
.spinning {
	animation: spin 1s linear infinite;
}

/* Button States */
.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Keyboard Hints */
.keyboard-hint kbd {
	background: var(--vscode-keybindingLabel-background, rgba(128, 128, 128, 0.2));
	border: 1px solid var(--vscode-keybindingLabel-border, rgba(128, 128, 128, 0.4));
	border-radius: 3px;
	padding: 1px 4px;
	font-family: inherit;
	font-size: calc(var(--vscode-font-size) * 0.85);
}

/* Empty State */
.messages-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: var(--vscode-descriptionForeground);
	text-align: center;
	padding: 20px;
}

/* Chat Input Disabled State */
.chat-input-disabled {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	color: var(--vscode-descriptionForeground);
	font-size: 12px;
	opacity: 0.7;
}

/* New Agent Form Parity Styles */
.new-agent-input-wrapper {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	background: var(--vscode-editor-background);
	padding: 0 6px 4px 6px;
	border-radius: 4px;
	width: 100%;
	box-sizing: border-box;
}

.new-agent-input-inner {
	position: relative;
	flex: 1;
	display: flex;
	flex-direction: column-reverse;
	min-height: 0;
	overflow: hidden;
	border-radius: 4px;
}

.new-agent-textarea {
	width: 100%;
	color: var(--vscode-input-foreground);
	font-family: var(--vscode-font-family);
	font-size: var(--vscode-editor-font-size);
	line-height: var(--vscode-editor-line-height);
	cursor: text;
	padding: 6px 8px;
	background: var(--vscode-input-background);
	border: 1px solid transparent;
	min-height: 90px;
	box-sizing: border-box;
	border-radius: 4px;
	resize: none;
	overflow-x: hidden;
	overflow-y: auto;
	padding-right: 36px;
	padding-bottom: 64px;
	z-index: 2;
}

.new-agent-textarea:focus,
.new-agent-textarea.focused {
	outline: 1px solid var(--vscode-focusBorder);
	border-color: var(--vscode-focusBorder);
}

.new-agent-gradient {
	position: absolute;
	bottom: 1px;
	left: 8px;
	right: 8px;
	height: 64px;
	background: linear-gradient(to top, var(--vscode-input-background), var(--vscode-input-background), transparent);
	pointer-events: none;
	z-index: 2;
}

.new-agent-button-container {
	position: absolute;
	bottom: 8px;
	right: 8px;
	z-index: 30;
}

.new-agent-send-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid transparent;
	padding: 6px;
	border-radius: 6px;
	min-width: 28px;
	min-height: 28px;
	opacity: 0.6;
	color: var(--vscode-descriptionForeground);
	cursor: pointer;
	transition: all 0.15s;
}

.new-agent-send-btn:hover:not(:disabled) {
	opacity: 1;
	color: var(--vscode-foreground);
	background-color: rgba(255, 255, 255, 0.03);
	border-color: rgba(255, 255, 255, 0.15);
}

.new-agent-send-btn:focus-visible {
	outline: 1px solid var(--vscode-focusBorder);
}

.new-agent-send-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	filter: grayscale(30%);
}
